package com.android.filter.jni;

import android.graphics.Bitmap;
import android.util.Log;

public class EffectJNI {
	static String TAG = "mosaic";
	public static native void nativeMosaic(Bitmap  input_bitmap);
//	public static native void nativeMakeGradient(Bitmap  input_bitmap);
	public static native void nativeMakeGrid();
	public static synchronized native void nativeFreeMemory();
	public static native void nativeMosaicStyle(int gridType);
	public static native void nativeTileSize(float tile_size);
	public static native void nativeTileHeight(float  tile_height);
	public static native void nativeTileSpacing(float  tile_spacing);
	public static native void nativeTileNeatness(float  tile_neatness);
	public static native void nativeLightDirection(float  light_dir);
	public static native byte[] nativeGetEdgeBuffer();
	public static native VertexInfo nativeGetGeometricPointList();
	public static native int nativeSetEdgeBuffer(byte[] mGrad, byte[] vGrad, byte[] hGrad, int width, int height);
	public static native void nativeFillColor(int num_geometric, int[] indices, int[] geometric_colors, int[] vertices, Bitmap output);
	public static synchronized VertexInfo nativeWrapMakeGrid(int gridType, Bitmap input_bitmap )
	{
		nativeMosaicStyle(gridType);
		nativeMakeGrid();
		nativeMosaic(input_bitmap);
		return nativeGetGeometricPointList();
	}
	static {
		try{
			System.loadLibrary("Mosaic");
			if (Log.isLoggable(TAG, Log.INFO))
				Log.i(TAG, "dl Mosaic success.");
		} catch (SecurityException se) {
			if (Log.isLoggable(TAG, Log.WARN))
				Log.w(TAG, "dl Mosaic SecurityException occurred");
		} catch (UnsatisfiedLinkError ule) {
			if (Log.isLoggable(TAG, Log.WARN))
				Log.w(TAG, "dl Mosaic UnsatisfiedLinkError occurred");
		} 
	}
	public static final int SQUARES = 0;
	public static final int HEXAGONS  = 1;
	public static final int OCTAGONS  = 2;
	public static final int TRIANGLES = 3;
	
}
